<?php 
include "includes/session.php";
include "includes/comunes.php";
$sql="select * from (select * from  boletocompra,personas,vehiculo where boletoVendedor=personaId and boletoVehiculo=idAuto) as T1
 ";
//armo el Where de la consutla
$where=" where boletoId=".$_GET['bol_id'];
$result= cons_sql_up($sql.$where);
$reg=mysql_fetch_array($result);



?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sistema de Gestion de Vehiculos</title>

<link href="estilos.css" rel="stylesheet" type="text/css" />

<!--libreria jquery central-->
<script src="jquery-ui/js/jquery-1.9.1.js"></script>
<!--fin libreria central-->

<!--Librerias para el combo-->
<script language="JavaScript" type="text/javascript" src="combos/jquery.chainedSelects.js"></script>
<!--fin libreria-->

<!--librerias ui-->
<link href="jquery-ui/css/ui-lightness/jquery-ui-1.10.2.custom.css" rel="stylesheet"/>
<script src="jquery-ui/js/jquery-ui-1.10.2.custom.js"></script>
<!--fin libreria-->
<!--estilo para el scroll-->
<style>
  .ui-autocomplete {
    max-height: 300px;
    overflow-y: auto;
    /* prevent horizontal scrollbar */
    overflow-x: hidden;
  }
  /* IE 6 doesn't support max-height
   * we use height instead, but this forces the menu to always be this tall
   */
  * html .ui-autocomplete {
    height: 300px;
  }
  </style>
<!--
  fin estilo scroll-->


<script language="JavaScript" type="text/javascript">
$(function()
{

//        funcion que implementa combos
	$('#marca').chainSelect('#modelo','combomarcamodelo.php',
	{
		before:function (target) //before request hide the target combobox and display the loading message
		{
			$("#loading").css("display","block");
			$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{
			$("#loading").css("display","none");
			$(target).css("display","inline");
		}
	});
        
        $('#modelo').chainSelect('#version','combomodeloversion.php',
	{
		before:function (target) //before request hide the target combobox and display the loading message
		{
			$("#loading").css("display","block");
			$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{
			$("#loading").css("display","none");
			$(target).css("display","inline");
		}
	});
        
        
           $('#venpro').chainSelect('#venloc','comboprolocalidad.php',
	{
		before:function (target) //before request hide the target combobox and display the loading message
		{
			$("#loading").css("display","block");
			$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{
			$("#loading").css("display","none");
			$(target).css("display","inline");
		}
	});
        
//        fin funcion

// busco datos en caso de que existA

$("#imgbus").click(function(evento){
      evento.preventDefault();
      $("#vendedor").load("datosVendedor.php", {dni: $("#vendni").val()});
   });
   
   
  $("#imgbus").click(function(evento){
      evento.preventDefault();
      $("#vendedor").load("datosVendedor.php", {dni: $("#vendni").val()});
   }); 
   




//          funcion que implementa autocompletado de articulos
     
// $( "#fechapla" ).datepicker({
//         dateFormat: "yy-mm-dd"
//
//      });


		
		$( "#vendni" ).autocomplete({
			source: "autoPersona.php"
		});
                
                $( "#accdni" ).autocomplete({
			source: "autoAccionista.php"
		});
                $( "#accdni1" ).autocomplete({
			source: "autoAccionista.php"
		});
                $( "#accdni2" ).autocomplete({
			source: "autoAccionista.php"
		});
                   $( "#accdni3" ).autocomplete({
			source: "autoAccionista.php"
		});
             

//          fin funcion



//              funcion para validacion de formularios

             $("#altavehiculo").submit(function () {

                  if (confirm('Esta seguro que confirma el pedido?')){ 
					   return true;
					}else
					   return false;
                    
               
        });

//              fin funcion
      $("#accpor").change(function(){
               
                        var1=($("#accpor").val())/100;
						if ($("#contipo").val()==2){
						 var2=$("#preciocosto").val() -$("#preciocosto").val() ;}
						else{
                        var2=$("#preciocosto").val();}
						
                        monto=var1*var2;
                       
                       $("#accmon").val(monto); 
                         

             });
             
          $("#accpor1").change(function(){
               
                        var1=($("#accpor1").val())/100;
                        if ($("#contipo").val()==2){
						 var2=$("#preciocosto").val() -$("#preciocosto").val() ;}
						else{
                        var2=$("#preciocosto").val();}
                        monto=var1*var2;
                       
                       $("#accmon1").val(monto); 
                         

             });   
             
             $("#accpor2").change(function(){
               
                        var1=($("#accpor2").val())/100;
                        if ($("#contipo").val()==2){
						 var2=$("#preciocosto").val() -$("#preciocosto").val() ;}
						else{
                        var2=$("#preciocosto").val();}
                        monto=var1*var2;
                       
                       $("#accmon2").val(monto); 
                         

             });
			 
			 $("#accpor3").change(function(){
               
                        var1=($("#accpor3").val())/100;
                         if ($("#contipo").val()==2){
						 var2=$("#preciocosto").val() -$("#preciocosto").val() ;}
						else{
                        var2=$("#preciocosto").val();}
                        monto=var1*var2;
                       
                       $("#accmon3").val(monto); 
                         

             });
             
             
             
             //calculo el porcentaje de venta en caso de ser necesario
              $("#por").change(function(){
               
                        var1=($("#por").val())/100;
                        var2=$("#preciocosto").val();
                        monto=(parseFloat(var1*var2)+parseFloat(var2));
                      
                       
                       $("#precioventa").val(monto); 
                         

             });
			 
			  $("#preciotoma").change(function(){
                      monto=$("#preciotoma").val();
                      $("#preciocosto").val(monto); 
                         

             });
             

});
</script>
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
</head>

<body>

<div class="container">
<?php include "includes/head.php"?>
   <div class="content">
       <div class="tituloprincipal">
          <?php include 'includes/submenu.php';?>  
           <img src="jquery-ui/css/ui-flexigrid/images/magnifier.png" width="25" height="25" border="0"/> Visualizar Datos del Boleto <?php echo $_GET['bol_id']?>
           </div>
       <form id="pedido" name="pedido" method="POST" action="editarVehiculo.php">
       <div class="contenedorpedido">
	  <fieldset>
              <legend><b>Datos de de la Operacion</b></legend> 
	   <table  width="100%">
				<tr>
                      <td class="textotablamenuform">Fecha Operacion</td>
                      <td class="textotablamenuform">
                          <?php echo format_fec($reg['boletofecha'],"/")?>
                      </td>
					  </tr>
                 <tr>
                      <td class="textotablamenuform">Vendedor</td>
                      <td class="textotablamenuform">
                          <?php echo $reg['personaDniCuit']." ".$reg['personaNombre']?>
                      </td>
					  </tr>
					  <?php if($reg['boletoAccionista']):?>
					  <tr>
                      <td class="textotablamenuform">Accionista 1</td>
                      <td class="textotablamenuform">
					      <?php echo obtener_nombre_personas($reg['boletoAccionista'])?> - 
                          <?php echo $reg['boletoAccionistaPor']?>% - 
                          $ <?php echo $reg['boletoAccionistaMonto']?>
                      </td>
					  </tr>
					  <?php endif?>
					  <?php if($reg['boletoAccionista1']):?>
					  <tr>
                      <td class="textotablamenuform">Accionista 2</td>
                      <td class="textotablamenuform">
					      <?php echo obtener_nombre_personas($reg['boletoAccionista1'])?> - 
                          <?php echo $reg['boletoAccionista1Por']?>% - 
                          $ <?php echo $reg['boletoAccionista1Monto']?>
                      </td>
					  </tr>
					  <?php endif?>
					  <?php if($reg['boletoAccionista2']):?>
					  <tr>
                      <td class="textotablamenuform">Accionista 3</td>
                      <td class="textotablamenuform">
					      <?php echo obtener_nombre_personas($reg['boletoAccionista2'])?> - 
                          <?php echo $reg['boletoAccionista2Por']?>% - 
                          $ <?php echo $reg['boletoAccionista2Monto']?>
                      </td>
					  </tr>
					  <?php endif?>
					  <?php if($reg['boletoAccionista3']):?>
					  <tr>
                      <td class="textotablamenuform">Accionista 3</td>
                      <td class="textotablamenuform">
					      <?php echo obtener_nombre_personas($reg['boletoAccionista3'])?> - 
                          <?php echo $reg['boletoAccionista3Por']?>% - 
                          $ <?php echo $reg['boletoAccionista3Monto']?>
                      </td>
					  </tr>
					  <?php endif?>
					  
					  </table>
			</fieldset>	
           
        <fieldset>
             <legend><b>Datos del Vehiculo</b></legend>
             <table>
                 <tr>
                     <td class="textotablamenuform">Categoria</td>
                     <td class="textotablamenuform">
					 <input type="hidden" class="campo_form" id="id" name="id" value="<?php echo $_GET['aut_id']?>">
                         <select name="categoria" id="categoria" class="campo_form" required disabled>
                             <option selected value="0">Seleccionar...</option>
                             <?php
                             $cat=obtener_categorias();

                             while($regPed=mysql_fetch_array($cat)){
							  if($regPed['idCategoria']==$reg['idCategoria'])
                                 echo "<option value='".utf8_encode($regPed['idCategoria'])."' selected>".utf8_encode($regPed['descripcion'])."</option>";
								 else
								 echo "<option value='".utf8_encode($regPed['idCategoria'])."'>".utf8_encode($regPed['descripcion'])."</option>";
								 
                             }

                             ?>

                         </select>


                     </td>
                     <td class="textotablamenuform">Marca</td>
                     <td class="textotablamenuform">
                         <select name="marca" id="marca" class="campo_form" required disabled>
                              <?php
                             $ped=obtener_marcas();
        
                             while($regPed=mysql_fetch_array($ped)){
							 if($regPed['id_marca']==$reg['idMarca'])
                                       echo "<option value='".utf8_encode($regPed['id_marca'])."' selected>".utf8_encode($regPed['descripcion'])."</option>";
									   else
									    echo "<option value='".utf8_encode($regPed['id_marca'])."'>".utf8_encode($regPed['descripcion'])."</option>";
									   
                           

                             }

                             ?>

                         </select>


                     </td>
                     <td class="textotablamenuform">Modelo</td>
                     <td class="textotablamenuform">
                          <?php echo obtener_nombre_modelo($reg['idModelo'])?>
                     </td>
                </tr>
                 <tr>
                     <td class="textotablamenuform">Version</td>
                     <td class="textotablamenuform">
                        <?php echo obtener_nombre_version($reg['idVersion'])?>
                     </td>
                     <td class="textotablamenuform">Año</td>
                     <td class="textotablamenuform">
                    <select name="ano" id="ano" class="campo_form" required disabled>
                              <?php
                             $ped=obtener_anos();

                             while($regPed=mysql_fetch_array($ped)){
							 if($regPed['id_ano']==$reg['ano'])
                                       echo "<option value='".utf8_encode($regPed['id_ano'])."' selected>".utf8_encode($regPed['descripcion'])."</option>";
									   else
									   echo "<option value='".utf8_encode($regPed['id_ano'])."'>".utf8_encode($regPed['descripcion'])."</option>";
									   
                           

                             }

                             ?>
                           

                         </select>
                     </td>
                     <td class="textotablamenuform">Color</td>
                     <td class="textotablamenuform">
                         
                        <select name="color" id="color" class="campo_form" required disabled>
                              <?php
                             $ped=obtener_color();
								
                             while($regPed=mysql_fetch_array($ped)){
							 if($regPed['id_color']==$reg['color'])
                                       echo "<option value='".utf8_encode($regPed['id_color'])."' selected>".utf8_encode($regPed['descripcion'])."</option>";
									   else
									   echo "<option value='".utf8_encode($regPed['id_color'])."'>".utf8_encode($regPed['descripcion'])."</option>";
                           

                             }

                             ?>
                           

                         </select>
                     
                     
                     
                     </td>
                 </tr>
                 <tr>
                    <td class="textotablamenuform">Condicion</td>
                     <td class="textotablamenuform">
                         <select name="condicion" id="condicion" class="campo_form" required disabled>
						 <?php if($reg['condicion']==2):?>
                              <option value='2' selected>Usado</option>
						<?php else:?>
						<option value='2'>Usado</option>
						<?php endif?>	
						<?php if($reg['condicion']==1):?>						
								<option value='1' selected>0 km</option>
								<?php else:?>
								<option value='1'>0 km</option>
								<?php endif?>	
                         </select>
                         
                     </td>

                    <td class="textotablamenuform">Kilometros</td>
                    <td class="textotablamenuform">
                        <input type="text" class="campo_form" id="km" name="km" value="<?php echo $reg['kilomtros']?>" disabled>
                    </td>
                     <td class="textotablamenuform">Precio Toma</td>
                   <td class="textotablamenuform">
                        <input type="number" class="campo_form" placeholder="Ej. 123421,43" disabled value="<?php echo $reg['precioToma']?>" disabled id="preciotoma" name="preciotoma" required>
                    </td>
                 </tr>
                  <tr>
                    <td class="textotablamenuform">Precio Costo</td>
                     <td class="textotablamenuform">
                            <input type="number" class="campo_form" placeholder="Ej. 123421,43" disabled value="<?php echo $reg['precioCosto']?>" disabled id="preciocosto" name="preciocosto" required>
                 
                         
                     </td>

                    <td class="textotablamenuform"></td>
                    <td class="textotablamenuform">
                        <!-- <input type="number" class="campo_form" id="por" name="por" value="" placeholder="Ej. 10"> -->
                    </td>
                       <td class="textotablamenuform"></td>
                     <td class="textotablamenuform">
                            <!-- <input type="number" class="campo_form" placeholder="Ej. 123421,43" id="precioventa" name="precioventa" required> -->
                 
                     </td>
                 </tr>
                   <tr>
                    <td class="textotablamenuform">Nro Chasis</td>
                     <td class="textotablamenuform" >
                            <input type="text" class="campo_form"  id="chasis" name="chasis" disabled value="<?php echo $reg['nroChasis']?>" required>
                 
                         
                     </td>
                   <td class="textotablamenuform">Nro Motor</td>
                     <td class="textotablamenuform" >
                            <input type="text" class="campo_form"  id="motor" name="motor" disabled value="<?php echo $reg['nroMotor']?>" required>
                 
                         
                     </td>
                   
                   <td class="textotablamenuform">Nro Patente</td>
                     <td class="textotablamenuform" >
                            <input type="text" class="campo_form"  id="patente" name="patente" disabled value="<?php echo $reg['patente']?>" required>
                 
                         
                     </td>
                   
                 </tr>
                 
                 
                 <tr>
                    <td class="textotablamenuform">Caracteristicas</td>
                     <td class="textotablamenuform" colspan="5">
                            <input type="text" class="campo_form" disabled placeholder="Ej. Cierre Centralizado, alarma, etc" id="carac" value="<?php echo $reg['caracteristicas']?>" name="carac" >
                 
                         
                     </td>

                   
                 </tr>
				 <tr>
                      <td class="textotablamenuform" colspan="6">Observacion</td>
					  </tr>
					  <tr>
                      <td class="textotablamenuform" colspan="6">
					  <textarea cols="95" rows="15" name="observacion" id="observacion" disabled><?php echo $reg['boletoObservacion']?></textarea>
                          
                      </td>
					  </tr>
                 
                 
             </table>
        </fieldset>
      
           
		   
		   
           <fieldset style="text-align: right;">  
            <table style="text-align: right;">
             <tr>
                    <td class="textotablamenuform" style="text-align: right;" colspan="5">
                         <input type="button" name="enviar" value="Imprimir"  onclick="window.print();" class="boton_form"/>
                         
                     </td>
                 </tr>
                   </table>      
           </fieldset>  
		   
        
           
           
           
       </div>
   </form>
       <div class="clear"></div>
   <br>
   </div>
  <?php include "includes/pie.php"?>
  
</div>
</body>
</html>
